﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace no2paintdemo
{
    public partial class Form1 : Form
    {
        private SolidBrush myBrush;
        private Graphics myGraphics;
        private bool IsPainting = false;
        public Form1()
        {
            InitializeComponent();
        }

        private void splitContainer1_Panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void splitContainer2_Panel2_Paint(object sender, PaintEventArgs e)
        {

        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {

        }

        private void splitContainer2_Panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            myBrush = new SolidBrush(mau.BackColor);
           
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void mau_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog()==DialogResult.OK)
            {
                myBrush.Color = colorDialog1.Color;
            }
        }

        private void panel1_MouseDown(object sender, MouseEventArgs e)
        {
            IsPainting = true;
        }

        private void panel1_MouseUp(object sender, MouseEventArgs e)
        {
            IsPainting = false;
        }

        private void panel1_MouseMove(object sender, MouseEventArgs e)
        {
            if (IsPainting==true)
            {
                myGraphics = vung_ve.CreateGraphics();
                myGraphics.FillEllipse(myBrush, e.X, e.Y, trackBar1.Value, trackBar1.Value);
            }
        }

        private void btn_Clear_Click(object sender, EventArgs e)
        {
            Graphics g1 = vung_ve.CreateGraphics();
            g1.Clear(vung_ve.BackColor);
        }

        private void Exit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void mau_Paint(object sender, PaintEventArgs e)
        {

        }
    }
}
